<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var name= 1;
    var MyObj = {
        name: 2,
        showName: function(){
            console.log(this.name);
        }
    }
    setTimeout(MyObj.showName,1000)
    /*解决方法1：箭头函数*/
    setTimeout(()=>{MyObj.showName()},1000)
    setTimeout(function () {
        MyObj.showName()
    },1000)

    /*解决方法2：箭头函数*/
    setTimeout(MyObj.showName.bind(MyObj),1000)
</script>

</body>
</html>